package org.imaginedays.androidall.ui;

import org.imaginedays.androidall.R;
import org.imaginedays.androidall.wifi.WifiAP;

import android.app.Activity;
import android.content.Context;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ToggleButton;

/**
 * wifi 热点建立
 * 
 * @author imaginedays
 * 
 */
public class WifiApACT extends Activity implements OnCheckedChangeListener {

	private ToggleButton toggleBtn;
	private WifiAP wifiAp;
	private WifiManager wifiMgr;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.wifi_ap);
		wifiAp = new WifiAP();
		wifiMgr = (WifiManager) getSystemService(Context.WIFI_SERVICE);
		toggleBtn = (ToggleButton) findViewById(R.id.toggleBtn);
		toggleBtn.setOnCheckedChangeListener(this);
	}

	@Override
	public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
		wifiAp.toggleWiFiAP(wifiMgr, this);
	}

}
